package com.epam.javalab.giorgadze.task2.entity;

public class Symbol implements SentencePart {
    private char symbol;

    public char getSymbol() {
        return symbol;
    }

    public void setSymbol(char symbol) {
        this.symbol = symbol;
    }

    public Symbol(char symbol) {
        this.symbol = symbol;
    }

    public Symbol() {
    }

    public Symbol(String symbol) {
        char[] chars = symbol.toCharArray();
        this.symbol = chars[0];
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Symbol symbol1 = (Symbol) o;

        if (symbol != symbol1.symbol) return false;

        return true;
    }

    @Override
    public int hashCode() {
        return (int) symbol;
    }

    @Override
    public String toString() {
        return ""+symbol;
    }

    @Override
    public void add(Object element) {
        throw new UnsupportedOperationException("Cannot do this operation!");
    }

    @Override
    public void remove(Object element) {
        throw new UnsupportedOperationException("Cannot do this operation!");
    }
}
